package com.sleep.ruledemo.domian;

import lombok.Data;

/**
 * @author GuoAo
 * @className R
 * @date 2025/3/15
 * @description TODO
 */
@Data
public class R <T> {
    T data;
    String msg;
    int code;

    public static <T> R ok (T data) {
        R<T> r = new R<>();
        r.setData(data);
        r.setCode(200);
        r.setMsg("success");
        return r;
    }

    public static <T> R error (T data) {
        R<T> r = new R<>();
        r.setData(data);
        r.setCode(500);
        r.setMsg("error");
        return r;
    }
}
